#ifndef OBJECT_H
#define OBJECT_H

#include "LeadIn.h"

#include <string>
#include <fstream>
#include <map>
class ObjectDefaults;
class DataType;
class DataValue;
class DataArray;
class RawDataInfo;

class Object
{
    friend class ObjectDefaults;
public:
    typedef std::pair<std::string, const DataValue *> Property;

    Object( std::ifstream &infile, ObjectDefaults *objectDefaults, LeadIn* li );
    Property readProperty();
    void readPath();
    void readRawDataInfo();
    void readPropertyCount();
    void readRawData();
    bool hasRawData() const;
    const std::string& getPath() const;
    const DataType *getDataType() const;
    const DataArray *getRawData() const;

    int getDimension() {return dimension;} ;
    int getNValue() {return nvalue;} ;
    int getNBytes() {return nbytes;}

    static void addEntry( const std::string &key, RawDataInfo * value );
    static RawDataInfo *getRawDataInfo( const std::string &key );

private:
    std::ifstream& infile;
    ObjectDefaults *objectDefaults;
    std::string path;
    std::map<std::string, std::string> properties;
    unsigned int rawDataIndex;
    bool flagHasRawData;
    unsigned int propertyCount;
    const DataType *dataType;
    int dimension;
    long long nvalue;
    long long nbytes;
    DataArray *rawData;
    static std::map<std::string, RawDataInfo * >   rawDataInfoMap;

    LeadIn *_ptrLeadIn;
};

#endif
